<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="col-sm-6">
	<form id='agentQueryForm' class="form-inline">
	<div class="input-group" style="">
		<select id="query_level" name="level" class="form-control">
			<option value="" >全部级别</option>
			<option value="0">特级代理</option>
			<option value="1">一级代理</option>
			<option value="2">二级代理</option>
			<option value="3">三级代理</option>
		</select>
		<script>
		$("#query_level").val("${level}");
		</script>
	</div>
	<div class="input-group input-daterange">
	
		<input id="queryInputStr" value="${queryStr }" type="text" name="queryStr" class="form-control search-query" placeholder="输入ID或昵称">
		
		<input id="queryInputAgentId" type="hidden" name="agentId" value="${agentId }" />
		<span class="input-group-btn">
			<button type="button" class="btn btn-purple btn-sm" onclick="refreshPage()">
				<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
				查询
			</button>
			<button style="margin-left:10px;" type="button" class="btn btn-primary btn-sm" onclick="openAgentDialog()">
				<span class="ace-icon fa fa-plus icon-on-right bigger-110"></span>
				设置代理
			</button>
			
			<c:if test="${1 == sessionScope.session_admin_user_key.roleId}" >
			<button style="margin-left:10px;" type="button" class="btn btn-warning btn-sm" onclick="openUnAgentDialog()">
				<span class="ace-icon fa fa-minus icon-on-right bigger-110"></span>
				解除代理
			</button>
			</c:if>
			
			<c:if test="${1 == sessionScope.session_admin_user_key.roleId}" >
			<button style="margin-left:10px;" type="button" class="btn btn-danger btn-sm" onclick="opeanChargeDialog()">
				<span class="ace-icon fa fa-rmb icon-on-right bigger-110"></span>
				充值
			</button>
			</c:if>
			
			
			
		</span>
		<div id="agentDialog" style="padding-top: 13px;display:none;">
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<tbody>
				<tr id="">
					<td align="right" style="width:100px;">玩家ID：</td>
					<td align="left">
					<input id='setagent_userid' 
					onkeyup="javascript:this.value=this.value.replace(/[^\d]/g,'')"
					type="text" class="form-control" 
					placeholder="请输入要设为代理的玩家ID" maxlength="255" style="width:98%;">
					</td>
				</tr>
				<tr id="">
					<td align="right" style="width:100px;">上级代理ID：</td>
					<td align="left">
					<input id='setagent_agentid' value="108800" type="text" class="form-control"
					onkeyup="javascript:this.value=this.value.replace(/[^\d]/g,'')"
					placeholder="请输入要设为代理玩家的上级代理ID或上级代理邀请码"  maxlength="255" style="width:98%;">
					</td>
				</tr>
				<tr id="">
					<td align="right" style="width:100px;">代理等级：</td>
					<td align="left">
					<select id='setagent_userLevel' class="form-control" id="form-field-select-1">
						<option value="0">特级代理</option>
						<option value="1">一级代理</option>
					</select>
					</td>
				</tr>
				<tr><td colspan="2"><div id="promptTxt" style="padding:10px;color:#f00;"></div></td></tr>
			</tbody></table>
			</div>
			<div id="unAgentDialog" style="padding-top: 13px;display:none;">
				<table id="table_report" class="table table-striped table-bordered table-hover">
					<tbody>
					<tr id="">
						<td align="right" style="width:100px;">玩家ID：</td>
						<td align="left">
						<input id='unsetagent_userid' 
						onkeyup="javascript:this.value=this.value.replace(/[^\d]/g,'')"
						type="text" class="form-control" 
						placeholder="请输入要解除代理的玩家ID" maxlength="255" style="width:98%;">
						</td>
					</tr>
					<tr><td colspan="2"><div id="promptTxt1" style="padding:10px;color:#f00;"></div></td></tr>
				</tbody></table>
			</div>
			<div id="charge_confrimDialog" style="display:none">
				<div class="col-xs-12 col-sm-12 center">
					<div>
						<span class="profile-picture">
							<img id="avatar" width=182 height=182 onerror="onerror=null;src='https://res.wx.qq.com/a/wx_fed/common_assets/16120602/win_weixin21/images/phone_logo2x.png'" class="editable img-responsive editable-click editable-empty" src=""></img>
						</span>
		
						<div class="space-4"></div>
		
					</div>
					<div class="profile-user-info profile-user-info-striped hover" style="width:100%;margin:0">
						<div class="profile-info-row">
							<div class="profile-info-name"> 用户ID/昵称</div>
		
							<div class="profile-info-value">
								<span id=confrim_nickName class="editable editable-click" id="username">ss</span>
							</div>
						</div>
		
						<div class="profile-info-row">
							<div class="profile-info-name"> 邀请人 </div>
		
							<div class="profile-info-value">
								<span id=confrim_father class="editable editable-click" id="username"></span>
							</div>
						</div>
		
						<div class="profile-info-row">
							<div class="profile-info-name"> 现有金币 </div>
		
							<div class="profile-info-value">
								<span id=confrim_now class="editable editable-click"></span>
							</div>
						</div>
		
						<div class="profile-info-row">
							<div class="profile-info-name">充值金额</div>
		
							<div class="profile-info-value">
								<span style="color: red;font-weight: bolder;" class="editable editable-click" id="confrim_thistime"></span>
							</div>
						</div>
					</div>
				</div>				
			</div>
			<div id="unagent_confrimDialog" style="display:none">
				<div class="row">
				<div class="col-sm-12 center">
					<div>
						<span class="profile-picture">
							<img id="unagent_avatar" width=182 height=182 onerror="onerror=null;src='https://res.wx.qq.com/a/wx_fed/common_assets/16120602/win_weixin21/images/phone_logo2x.png'" class="editable img-responsive editable-click editable-empty" src=""></img>
						</span>
		
						<div class="space-4"></div>
		
					</div>
					<div class="profile-user-info profile-user-info-striped hover" style="width:100%;margin:0">
						<div class="profile-info-row">
							<div class="profile-info-name"> 用户ID/昵称</div>
		
							<div class="profile-info-value">
								<span  class="editable editable-click" id="unagent_user"></span>
							</div>
						</div>
						
						<div class="profile-info-row">
							<div class="profile-info-name"> 代理ID</div>
		
							<div class="profile-info-value">
								<span  class="editable editable-click" id="unagent_userAgentId"></span>
							</div>
						</div>
		
						<div class="profile-info-row">
							<div class="profile-info-name" style="width:130px">父级用户</div>
							<div class="profile-info-value">
								<span class="editable editable-click" id="unagent_user_father"></span>
							</div>
						</div>	
						
						<div class="profile-info-row">
							<div class="profile-info-name" style="width:130px">父级代理ID</div>
							<div class="profile-info-value">
								<span class="editable editable-click" id="unagent_user_father_agentId"></span>
							</div>
						</div>	
						
						
						
						
						<div class="profile-info-row">
							<div class="profile-info-name"> 关联后台用户账号 </div>
							<div class="profile-info-value">
								<span class="editable editable-click" id="unagent_user_admin"></span>
							</div>
						</div>						
					</div>
				</div>
				</div>			
			</div>
			<div id="chongzhiDialog" style="padding-top: 13px;display:none;">
				<table id="table_report" class="table table-striped table-bordered table-hover">
					<tbody>
					<tr>
						<td style="width:75px;text-align: right;padding-top: 13px;">我的﻿金币:</td>
						<td><span id="chongzhiDialog_goldCoinCount">0</span></td>
					</tr>
					<tr>
						<td style="width:75px;text-align: right;padding-top: 13px;">充值账户:</td>
						<td><span id="chongzhiDialog_userId">112007</span></td>
					</tr>
					<tr>
						<td align="right" style="width:100px;">充值类型：</td>
						<td align="left">
							金币
						</td>
					</tr>
					<tr id="inNumber">
						<td align="right" style="width:100px;">输入数量：</td>
						<td align="left"><input id='chongzhi_num' type="text" class="form-control" placeholder="请输入数量" value="1" maxlength="5" style="width:98%;"></td>
					</tr>
					<tr><td colspan="2"><div id="promptTxt" style="padding:10px;color:#f00;"></div></td></tr>
				</tbody></table>
				</div>
	</div>
	</form>
</div>
<div class="col-sm-2">
	<c:if test="${agentId != null }">
			<button style="margin-left:20px;" class="btn btn-sm btn-primary" title="点击返回" onclick="returnTop()">
				
				正在查看【${agentId}】的下属代理
				<i class="ace-icon fa fa-reply icon-on-right"></i>
			</button>
			</c:if>
</div>
<div class="col-xs-12" style="margin-top:5px;">
	<table id="simple-table" class="table table-bordered table-hover">
		<thead>
			<tr>
				<th class="center">
					
				</th>
				<th class="center">序号</th>
				<th class="center">用户头像</th>
				<th class="center">ID</th>
				<th class="center">用户昵称</th>
				<th class="center">邀请码</th>
				<th class="center">代理级别</th>
				<th class="center">房卡数</th>
				<th class="center">金币数</th>
				<th class="center">充值总额</th>
				<th class="center">上级ID</th>
				<th class="center">微信号</th>
				<th class="center">电话</th>
				<th class="center">状态</th>
				<th class="center">操作</th>
			</tr>
		</thead>
		
		<tbody>
			<c:forEach items="${data}" var="itm" varStatus="i">  
		       <tr>
					<td class="center">
						<label class="pos-rel">
							<input name='selectUser' type="radio" 
							userId="${itm.userId }" 
							nickName="${itm.nickName }" 
							goldCoinCount="${itm.score }" 
							userImg="${itm.userImg }" 
							groupId="${itm.groupId }" 
							class="ace">
							<span class="lbl"></span>
						</label>
					</td>
		
					<td class="center">
						${i.index + 1}
					</td>
				    <td class="center">
				    <img width=50 height=50 src="${itm.userImg }" onerror="onerror=null;src='https://res.wx.qq.com/a/wx_fed/common_assets/16120602/win_weixin21/images/phone_logo2x.png'" />
				    </td>
					<td class="center">
						<a href="javascript:void(0)" onclick="nextAgent(${itm.agentId })" title="点击查看下属代理">${itm.userId }
						<i class="ace-icon fa fa-sort-amount-desc bigger-110 icon-only"></i>
						</a>
					</td>
					<td class="center">${itm.nickName }</td>
					<td class="center">${itm.agentId }</td>
					<td class="center">${itm.agentLevel }</td>
		
					<td class="center">
						${itm.goldeggs }
					</td>
					<td class="center">${itm.score }</td>
					<td class="center">${itm.totalFee }</td>
					<td class="center">${itm.groupId }</td>
					<td class="center">${itm.accounts }</td>
					<td class="center">${itm.phoneNum }</td>
					<td class="center">
					<c:set var="checked" value="checked=checked" />
					<c:if test="${itm.online == 0}">
					<c:set var="checked" value="" />
					</c:if>
					<label>
						<input name="switch-field-1"  onclick="return false;" class="ace ace-switch ace-switch-3" type="checkbox" ${checked }>
						<span class="lbl" style='cursor:auto;'></span>
					</label>
					</td>
					<td class="center">
						<button onclick="loadPlayerData(${itm.userId})" class="btn btn-danger btn-xs" title="查看下属玩家">
							<i class="ace-icon fa fa-sort-amount-desc bigger-110 icon-only"></i>
						</button>
					</td>
				</tr>
		    </c:forEach>  
				
			</tbody>
		</table>
		<%@include file="../paging.jsp" %>
</div>

